<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="pt" lang="pt-br">

<f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>Sos:Cadastro</title>
            </f:facet>
            <h:outputStylesheet name="css/default.css" />
            <h:outputStylesheet name="css/estilo.css" />
        </h:head>
        <h:body>
			<div id="global">
            <p:layout fullPage="true" >
            
                <p:layoutUnit id="bottom" position="south" size="30" >
                     <ui:include src="../rodape.xhtml" />
                </p:layoutUnit>
                
                <p:layoutUnit id="center" position="center">
                
					<div id="menu" >
						<ui:include src="../menu.xhtml" />						
					</div>
					
					<div id="corpo">
	                    <p:growl id="growl" showDetail="false" sticky="true" />
	                    <h:form >
							<p:panel header="Cadastro de Usuario" id="panelcorpo" style="box-shadow: 2px 9px 15px 1px #888;">
								<h:panelGrid >
									
									<h:inputHidden id="idUsuario" value="#{usuarioManager.usuario.id}" />
									<h:outputText value="Nome: " />
									<p:inputText value="#{usuarioManager.usuario.nome}" required="true" label="Nome"/>
									
									<h:outputText value="E-mail: " />
									<p:inputText value="#{usuarioManager.usuario.email}" required="true" label="E-mail">
										<f:validator validatorId="emailValidator" />
									</p:inputText>
									<h:outputText id="emailException" value="#{usuarioManager.msgEmailException}" />
									
									<h:outputText value="Cargo: " />  
									<h:selectOneMenu effect="fade" required="true" requiredMessage="Selecione um Cargo." value="#{usuarioManager.tipoUsuario}" >  
							            <f:selectItem itemLabel="Selecione" itemValue="" noSelectionOption="true" />
							            <f:selectItems value="#{usuarioManager.perfis}" />
							        </h:selectOneMenu>
							        
							        <h:outputText value="Senha: " />
									<p:password  redisplay="true" value="#{usuarioManager.usuario.senha}"
										required="true" promptLabel="Digite uma senha segura" weakLabel="Razoável" goodLabel="Boa" 
										strongLabel="Ótima" feedback="true"  minLength="6" maxlength="15"
										requiredMessage="O campo senha deve conter no minimo 6 caracteres."
										match="pwd2" validatorMessage="senha digitada incorretamente"/>
									
									<h:outputText value="Confirmar Senha: " />
									<p:password  redisplay="true" id="pwd2" value="#{usuarioManager.usuario.senha}" feedback="false"
									label="Password 2" required="true" />
									
									<h:panelGroup>
										<p:commandButton value="Cancelar" immediate="true" style="float:right;"
													action="#{reservaManager.cancelaReserva}" ajax="false" />
										<p:commandButton value="Salvar" style="float:right;" action="#{usuarioManager.salvar()}" ajax="false" update="growl"/>
									</h:panelGroup>
								</h:panelGrid>
							</p:panel>
		                 </h:form>
					</div>
                
                </p:layoutUnit>
            </p:layout>
            </div>
        </h:body>
        
    </f:view>
</html>